package com.itheima.reggie.mapper;

import com.itheima.reggie.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

/**
 * @Author: qingtao
 * @Date 2022/3/17 8:56
 */
public interface UserMapper {

    /**
     * 根据电话号码查询
     * @param phone
     * @return
     */
    @Select("select * from `user` where phone=#{phone}")
    User findByPhone(String phone);

    /**
     * 插入
     * @param user
     * @return
     */
    @Insert("insert into `user` (phone,`status`) values (#{phone},#{status})")
    Integer save(User user);

    @Select("select * from `user` where id=#{id}")
    User findById(Long id);
}
